//所有数据通过客户端的心跳拉取获得，
//服务器主动发包时，只是将包cache入，每个bot中
//在bot心跳时，主动发出
export enum MsgType {
    sc_new,
    cs_new,
    sc_login,//新的登录要求已经没用了？
    cs_login,//登录结果

    cs_getgroupconfig,//拉取配置
    sc_groupconfig,//返回配置,也可能通过用户操作主动变迁

    sc_contactgroups,//联系群刷新请求,,广播
    cs_contactgroups,//联系群列表

    cs_creategame,//创建游戏请求
    sc_creategame,//创建游戏结果

    cs_gameinfo,//获取游戏信息
    sc_gameinfo,//游戏情况变化通知

    cs_leavegroup,//离开群
    cs_invitegroup,//加入群

    cs_configgroup,//由微信群中对话配置，服务器要返回配置连接
    sc_configgroup,

    cs_loginout,
    sc_loginout,
    sc_deleteroom,
    cs_groupnamechange,
    sc_grouppause,
    sc_broadcast
}

//服务器发包基础内容
export interface msgpack {
    type: MsgType;
    content: any;
}
export interface i_sc_new {
    user: string;
}
export interface i_cs_new {
    user: string;
    uuid: string;
}
export interface i_sc_login {
    user: string;
    snykey: any;//服务器端cache住
}
export interface i_cs_login {
    user: string;
    snykey: any;
}
export interface i_cs_getgroupconfig {
    user: string;
    group_name: string;
}
export interface i_sc_groupconfig {
    user: string;
    group_name: string;
    group_id: string;//我们服务器上的id
    agent: string;
    qrcode_url: string;
    pause: boolean;
    config: {//所有配置
        start_hour: number;
        end_hour: number;
        notice: string;//空字符串表示关闭下同
        notice_delay: number;
        new_member_yell: string;
        qrcode_url: string;
        keyword: string[];//是关键字,内容,关键字,内容

        room: {
            uuid: string;
            winner_yell: string;
            yell_context: string;
            yell_delay: number;
            gameType: string;
            playerMaxCount: number;
            maxRound: number;
            config: any;
        }[];
    } | null;
}

export interface i_sc_grouppause {
    user: string;
    group_name: string;
    group_id: string;//我们服务器上的id
    pause: boolean;
}

export interface i_sc_contactgroups {
    user: string;
}
export interface i_cs_contactgroups {
    user: string;
    contactgroups: {
        group_name: string;
        group_id: string | null;//如果被配置了那么就有这个量
        memberCount: number;
    }[]
}

export interface i_cs_creategame {
    agent: string;
    group_id: string;
    user: string;
    gameType: string;

    playerMaxCount: number;
    maxRound: number;
    config: any;
    roomUUID: string;//发上去等服务器回传的时候照样返回
}
export interface i_sc_creategame {
    user: string;
    group_id: string;
    roomId: number;
    roomUUID: string;
}
export interface i_cs_gameinfo {
    rooms: {
        group_id: string;
        user: string;
        gameType: string;
        roomId: number;
    }[];
}
export interface i_sc_gameinfo {
    //客户端自己去
    rooms: {
        group_id: string;
        user: string;
        roomId: number;
        currentPlayerCount: number | null;
        result: {
            uId: string;
            nickName: string;
            point: number;
            ip: string;
            gps: number[];
        }[] | null;
    }[];
}
export interface i_cs_leavegroup {
    user: string;
    group_id: string;
    member: string[];
}
export interface i_cs_invitegroup {
    user: string;
    group_id: string;
    tip: string;
}
export interface i_cs_configgroup {
    user: string;
    group_name: string;
    group_id: string | null;//如果被配置了那么就有这个量
}
export interface i_sc_configgroup {
    user: string;
    group_name: string;
    group_id: string | null;//如果被配置了那么就有这个量
    url: string;
}
export interface i_cs_loginout {
    user: string;
}
export interface i_sc_loginout {
    user: string;
}
export interface i_sc_deleteroom {
    user: string;
    group_id: string;
    roomId: number;
}
export interface i_cs_groupnamechange {
    user: string;
    group_id: string;
    group_name: string;
}
export enum WhiteType {
    agent,
    user,
    groupname
}
export interface i_sc_broadcast {
    type: string;
    context: string;
    whitelist: {
        whiteType: WhiteType;
        keyword: string;
    }[]
}
//login->客户端自己去getgroupconfig,,就得到了groupid，或者没得到
//说话聊天->生成并且cache->返回给用户